Skip to content

Conversation

nnethercote
Copy link
Contributor

codegen in src/librustc_codegen_llvm/back/write.rs is long and has complex control flow. These commits refactor it and make it easier to understand.

I find the code easier to read if the values in `config` are all used
directly, rather than a mix of `config` values and local variables. It
will also faciliate some of the following commits.

Also, use `config.bitcode_needed()` in one place.
Because the `(true, true)` combination isn't valid.
This adds a missing `!config.obj_is_bitcode` condition to two places
that should have it.

As a result, when `obj_is_bitcode` and `no_integrated_as` are both true,
the compiler will no longer unnecessarily emit asm, convert it to an
object file, and then overwrite that object file with bitcode.
@rust-highfive
Copy link
Contributor

r? @varkor

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 22, 2020
@nnethercote
Copy link
Contributor Author

I'm not sure who the best reviewer for this is. @varkor, please reassign review as appropriate.

Whoever does review it, please review one commit at a time, it'll be much easier that way.

@Mark-Simulacrum
Copy link
Member

cc @eddyb at least, I guess

@eddyb
Copy link
Member

eddyb commented Mar 23, 2020

@bors r+

@bors
Copy link
Collaborator

bors commented Mar 23, 2020

📌 Commit ca0f997 has been approved by eddyb

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 23, 2020
Centril added a commit to Centril/rust that referenced this pull request Mar 24, 2020
Refactor `codegen`

`codegen` in `src/librustc_codegen_llvm/back/write.rs` is long and has complex control flow. These commits refactor it and make it easier to understand.
Centril added a commit to Centril/rust that referenced this pull request Mar 24, 2020
Refactor `codegen`

`codegen` in `src/librustc_codegen_llvm/back/write.rs` is long and has complex control flow. These commits refactor it and make it easier to understand.
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 24, 2020
Rollup of 8 pull requests

Successful merges:

 - rust-lang#68884 (Make the `type_of` return a generic type for generators)
 - rust-lang#69788 (Fix sequence of Type and Trait in optin-builtin-traits in Unstable Book)
 - rust-lang#70074 (Expand: nix all fatal errors)
 - rust-lang#70077 (Store idents for `DefPathData` into crate metadata)
 - rust-lang#70213 (traits/fulfill: allow `stalled_on` to track `ty::Const::Infer(_)` (unused yet).)
 - rust-lang#70259 (Use Reveal::All in MIR optimizations)
 - rust-lang#70284 (correctly handle const params in type_of)
 - rust-lang#70289 (Refactor `codegen`)

Failed merges:

r? @ghost
@bors bors merged commit 170112c into rust-lang:master Mar 24, 2020
@nnethercote nnethercote deleted the refactor-codegen branch March 25, 2020 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants